<?php class Users { 

    /***
     * DB Fields: id
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $id;

    /***
     * DB Fields: name
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $name;

    /***
     * DB Fields: surname
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $surname;

    /***
     * DB Fields: password
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $password;

    /***
     * DB Fields: lang
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $lang;

    /***
     * DB Fields: email
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $email;

    /***
     * DB Fields: active
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $active;

    /***
     * DB Fields: karma
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $karma;

    /***
     * DB Fields: vacation
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $vacation;

    /***
     * DB Fields: profile
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $profile;

    /***
     * DB Fields: nick
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $nick;

    /***
     * DB Fields: vacationTime
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $vacationTime;

    /***
     * DB Fields: createdTime
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $createdTime;

    /***
     * DB Fields: lastLogin
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $lastLogin;

    /***
     * DB Fields: rol
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     **/
    var $rol;

//--------------- GET METHODS ----------------------------- //
    /***
     * Get value for field: id
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result id
     **/
    function get_id( ) {
        // returns the value of id
        return $this->id;
    }


    /***
     * Get value for field: name
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result name
     **/
    function get_name( ) {
        // returns the value of name
        return $this->name;
    }


    /***
     * Get value for field: surname
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result surname
     **/
    function get_surname( ) {
        // returns the value of surname
        return $this->surname;
    }


    /***
     * Get value for field: password
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result password
     **/
    function get_password( ) {
        // returns the value of password
        return $this->password;
    }


    /***
     * Get value for field: lang
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result lang
     **/
    function get_lang( ) {
        // returns the value of lang
        return $this->lang;
    }


    /***
     * Get value for field: email
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result email
     **/
    function get_email( ) {
        // returns the value of email
        return $this->email;
    }


    /***
     * Get value for field: active
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result active
     **/
    function get_active( ) {
        // returns the value of active
        return $this->active;
    }


    /***
     * Get value for field: karma
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result karma
     **/
    function get_karma( ) {
        // returns the value of karma
        return $this->karma;
    }


    /***
     * Get value for field: vacation
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result vacation
     **/
    function get_vacation( ) {
        // returns the value of vacation
        return $this->vacation;
    }


    /***
     * Get value for field: profile
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result profile
     **/
    function get_profile( ) {
        // returns the value of profile
        return $this->profile;
    }


    /***
     * Get value for field: nick
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result nick
     **/
    function get_nick( ) {
        // returns the value of nick
        return $this->nick;
    }


    /***
     * Get value for field: vacationTime
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result vacationTime
     **/
    function get_vacationTime( ) {
        // returns the value of vacationTime
        return $this->vacationTime;
    }


    /***
     * Get value for field: createdTime
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result createdTime
     **/
    function get_createdTime( ) {
        // returns the value of createdTime
        return $this->createdTime;
    }


    /***
     * Get value for field: lastLogin
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result lastLogin
     **/
    function get_lastLogin( ) {
        // returns the value of lastLogin
        return $this->lastLogin;
    }


    /***
     * Get value for field: rol
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @result rol
     **/
    function get_rol( ) {
        // returns the value of rol
        return $this->rol;
    }


//--------------- SET METHODS ----------------------------- //
    /***
     * Set value for field: id
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @result void
     **/
    function set_id( $id ) {
        // sets the value of id
        $this->id = $id;
    }

    /***
     * Set value for field: name
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param name
     * @result void
     **/
    function set_name( $name ) {
        // sets the value of name
        $this->name = $name;
    }

    /***
     * Set value for field: surname
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param surname
     * @result void
     **/
    function set_surname( $surname ) {
        // sets the value of surname
        $this->surname = $surname;
    }

    /***
     * Set value for field: password
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param password
     * @result void
     **/
    function set_password( $password ) {
        // sets the value of password
        $this->password = $password;
    }

    /***
     * Set value for field: lang
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param lang
     * @result void
     **/
    function set_lang( $lang ) {
        // sets the value of lang
        $this->lang = $lang;
    }

    /***
     * Set value for field: email
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param email
     * @result void
     **/
    function set_email( $email ) {
        // sets the value of email
        $this->email = $email;
    }

    /***
     * Set value for field: active
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param active
     * @result void
     **/
    function set_active( $active ) {
        // sets the value of active
        $this->active = $active;
    }

    /***
     * Set value for field: karma
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param karma
     * @result void
     **/
    function set_karma( $karma ) {
        // sets the value of karma
        $this->karma = $karma;
    }

    /***
     * Set value for field: vacation
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param vacation
     * @result void
     **/
    function set_vacation( $vacation ) {
        // sets the value of vacation
        $this->vacation = $vacation;
    }

    /***
     * Set value for field: profile
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param profile
     * @result void
     **/
    function set_profile( $profile ) {
        // sets the value of profile
        $this->profile = $profile;
    }

    /***
     * Set value for field: nick
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param nick
     * @result void
     **/
    function set_nick( $nick ) {
        // sets the value of nick
        $this->nick = $nick;
    }

    /***
     * Set value for field: vacationTime
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param vacationTime
     * @result void
     **/
    function set_vacationTime( $vacationTime ) {
        // sets the value of vacationTime
        $this->vacationTime = $vacationTime;
    }

    /***
     * Set value for field: createdTime
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param createdTime
     * @result void
     **/
    function set_createdTime( $createdTime ) {
        // sets the value of createdTime
        $this->createdTime = $createdTime;
    }

    /***
     * Set value for field: lastLogin
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param lastLogin
     * @result void
     **/
    function set_lastLogin( $lastLogin ) {
        // sets the value of lastLogin
        $this->lastLogin = $lastLogin;
    }

    /***
     * Set value for field: rol
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param rol
     * @result void
     **/
    function set_rol( $rol ) {
        // sets the value of rol
        $this->rol = $rol;
    }

//--------------- CRUD METHODS ----------------------------- //
    /***
     * Create a new Record: users
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @param name
     * @param surname
     * @param password
     * @param lang
     * @param email
     * @param active
     * @param karma
     * @param vacation
     * @param profile
     * @param nick
     * @param vacationTime
     * @param createdTime
     * @param lastLogin
     * @param rol
     * @result void
     **/
    function createnew_users( $id, $name, $surname, $password, $lang, $email, $active, $karma, $vacation, $profile, $nick, $vacationTime, $createdTime, $lastLogin, $rol ) {

        // items to be inserted in the database 
        $_obj = array($id,
                      $name,
                      $surname,
                      $password,
                      $lang,
                      $email,
                      $active,
                      $karma,
                      $vacation,
                      $profile,
                      $nick,
                      $vacationTime,
                      $createdTime,
                      $lastLogin,
                      $rol); 

        // database object connection
        $dbConn = $GLOBALS['dbConn'];

        // perform insert in the database
        $dbConn->insert("users", $_obj);
    }

    /***
     * Retrived an existing record: users
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @result new Users
     **/
    function get_users( $id ) {

        // retrive the data
        $dbConn = $GLOBALS['dbConn'];

        // retrieved value in the database
        $_resultSet = $dbConn->doQuery("SELECT * FROM users WHERE id = '$id'");

        $__usersObj = new users();
        // return the retrived from the database

        // create a new object
        $__obj = new Users();
        $__obj->set_id($_resultSet[0]['id']);
        $__obj->set_name($_resultSet[0]['name']);
        $__obj->set_surname($_resultSet[0]['surname']);
        $__obj->set_password($_resultSet[0]['password']);
        $__obj->set_lang($_resultSet[0]['lang']);
        $__obj->set_email($_resultSet[0]['email']);
        $__obj->set_active($_resultSet[0]['active']);
        $__obj->set_karma($_resultSet[0]['karma']);
        $__obj->set_vacation($_resultSet[0]['vacation']);
        $__obj->set_profile($_resultSet[0]['profile']);
        $__obj->set_nick($_resultSet[0]['nick']);
        $__obj->set_vacationTime($_resultSet[0]['vacationTime']);
        $__obj->set_createdTime($_resultSet[0]['createdTime']);
        $__obj->set_lastLogin($_resultSet[0]['lastLogin']);
        $__obj->set_rol($_resultSet[0]['rol']);


        return $__obj;
    }

    /***
     * Update an existing record: users
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @param itemsToBeUpdated = array()
     * @result void
     **/
    function update_users( $id, $itemsToBeUpdated = array() ) {

         // get database connection
         $dbConn = $GLOBALS['dbConn'];

         // performs update in the database
         foreach($itemsToBeUpdated as $_fName => $_fVal) { 
               $dbConn->addValuePair($_fName, $_fVal);
         }

         // perform update operation
         $dbConn->update("users", "id = '$id'");
    }

    /***
     * Delete an existing record: users
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param id
     * @result void
     **/
    function delete_users( $id ) {

         // get database connection
         $dbConn = $GLOBALS['dbConn'];

         // performs deletion of data
         $dbConn->delete("users", "id = '$id'");
    }

    /***
     * Retrived list of objects base on a given parameters: users
     *
     *
     * THIS IS a generated method using the DBClassGenerator 
     * created by John paul de Guzman <jpdguzman@gmail.com> 
     *
     * @param conditionalStatement = ''
     * @result collection of objects: Users
     **/
    function list_users( $conditionalStatement = '' ) {

         $dbConn = $GLOBALS['dbConn'];
         // check if there is a given parameter list
         if(!empty($conditionalStatement)) { 
              $sqlStatement = "SELECT * FROM users WHERE $conditionalStatement"; 
         } else { 
              $sqlStatement = "SELECT * FROM users";
         }

         // retrieve the values base on the query result
         $__resObj = $dbConn->doQuery($sqlStatement);

         $__collectionOfObjects = array();
         foreach($__resObj as $__rs) { 
            $__newObj = new Users();

            $__newObj->set_id($__rs['id']);
            $__newObj->set_name($__rs['name']);
            $__newObj->set_surname($__rs['surname']);
            $__newObj->set_password($__rs['password']);
            $__newObj->set_lang($__rs['lang']);
            $__newObj->set_email($__rs['email']);
            $__newObj->set_active($__rs['active']);
            $__newObj->set_karma($__rs['karma']);
            $__newObj->set_vacation($__rs['vacation']);
            $__newObj->set_profile($__rs['profile']);
            $__newObj->set_nick($__rs['nick']);
            $__newObj->set_vacationTime($__rs['vacationTime']);
            $__newObj->set_createdTime($__rs['createdTime']);
            $__newObj->set_lastLogin($__rs['lastLogin']);
            $__newObj->set_rol($__rs['rol']);

            // add object to collection 
            array_push($__collectionOfObjects, $__newObj);
         }

         // return collection of objects
         return $__collectionOfObjects;
    }

} ?>